<% @folders=Folder.find(:all ,:conditions=>" user_id = #{session[CURRENT_USER_ID].to_s}")
%>
<div id="" style="width:700; height:25px;">
  

            <p style="margin-left:25px;">
             <a href="#"  onclick="delsome()";><img src="/images/user/report_list/delete.jpg" width="44"  height="23" /></a>
             <a href="#"  onclick="delall();"><img src="/images/user/report_list/delete_all.jpg" width="63" height="23" /></a>
             <a href="#"  onclick="markItems();"><img src="/images/user/report_list/biao_ji.jpg" width="86"  height="23" /></a>
             <a href="#"  onclick="removemarkItems();">
             <img src="/images/user/report_list/remove.jpg" width="63"  height="23" /></a>
             </p>
            <span class="top_list">
              <!--
              <select id="transfer_folder" style="margin-left:2px;" onchange="select_change();">
                   <option value="不移动" selected="selected" >移动到指定文件夹</option>
                   <% @folders.each do|f|%>
                   <option value="<%=f.id%>"><%=f.name%></option>
                   <% end %>
               </select>
               -->
               <a id="move-to" href="javascript:;" onclick="show_folder_selector('move-to');">移到</a>
               <div id="folder-selector" style="display:none;">
                 <div>
                   <form id="move-to-form">
                   
                     <table width="250px">
                       <tr>
                         <% @folders.each_with_index do |f, index| %>
                         <td>
                           <input type="radio" name="f_id" class="folder-id-radio" value="<%=f.id%>"/>&nbsp;
                           <%= f.name %>
                         </td>
                             <% if (index+1)%2 == 0 %>
                             </tr><tr>
                             <% end %>
                         <% end %>
                       </tr>
                     </table>
<style>
  #folder-selector{
    background-color: white;
    padding: 3px 3px 3px 3px;
    position:absolute;
    z-index:99;
  }
  #folder-selector div{
    background-color: white;
    padding: 10px 10px 10px 10px;
    border:2px solid #ABCDE6;
    line-height: 22px;
  }
</style>
                     <br />
                     <input type="button" value="确定" onclick="move_to_folder();"/>
                     <a href="javascript:;" onclick="$('folder-selector').hide();">取消</a>
                   </form>
                 </div>
               </div>
            </span>
            <span class="top_back">
                    <a href="/user/test/home"><img src="/images/back.png" width="88" height="27" /></a>
            </span>
            <br /><br />
  </div> 
            <div id="notice" style="margin-lfet:25px;height:25px;width:700px; padding-left:6px;">
            <% if flash[:notice] %>
            <font id="operate_result_notice" color="red">  <%=h(flash[:notice])%></font>
            <% end %>
          </div>    
 <div style="width:700px;margin-top:0px;">
<table width="670px" border="0" cellpadding="0" cellspacing="0" style="border-left:1px solid #dadada; border-top:1px solid #dadada;">
  <tr>  
    <td width="20px"  background="/images/user/report_list/bg_03.jpg" height="30"  valign="middle" style=" border-right:1px solid #dadada;">
    <input type="checkbox" name="all_seect" class="all_select" onclick="select_all(this);" style="margin-left:17px; display:inline;" />
    </td>                                                                             
     <td width="40px"  background="/images/user/report_list/bg_03.jpg" height="30" align="center" style=" border-right:1px solid #dadada;">标记</td>
      <td width="40px"  background="/images/user/report_list/bg_03.jpg" height="30" align="center" style=" border-right:1px solid #dadada;">状态</td>
    <td width="60px"  background="/images/user/report_list/bg_03.jpg" height="30" align="center" valign="middle" style=" border-right:1px solid #dadada;">姓名</td>
    <td width="150px"  background="/images/user/report_list/bg_03.jpg" height="30" align="center" style=" border-right:1px solid #dadada;">量表</td>
    <td width="160"  background="/images/user/report_list/bg_03.jpg" height="30" align="center" style=" border-right:1px solid #dadada;">测试时间</td>
     <td width="100px"  background="/images/user/report_list/bg_03.jpg" height="30" align="center" style=" border-right:1px solid #dadada;">所属文件夹</td>
          <td width="100px"  background="/images/user/report_list/bg_03.jpg" height="30" align="center" style=" border-right:1px solid #dadada;">测试帐号</td>
  </tr>
  <% if @test_records.size > 0 %>
  <%   @test_records.each do |record| %>
        	 <tr> 
               <td width="50"  height="30" align="center" valign="middle" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
          	  <input type="checkbox"class="check_boxes" id="check_boxes"  value="<%=record.id%>" style="margin:7px 0 0 0;">
          	  </input>  
          	  </td>
             <td height="30" align="center" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
             <% if record.importance=="重要" %>
             <img src="/images/user/report_list/importance.jpg"  width="20" height="20">
             <% else %>&nbsp;
             <%end%>
             </td>
          	  <td height="30" align="center" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
          	  <a href="/user/reports/show_report/<%=record.id%>">
                 <% if record.been_read==true %>
                 已读
                 <% elsif record.been_read==false %><b>
                 未读
                 </b></a>
                 <%end%>
             </td>
          	  <td height="30" align="center" valign="middle" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
          	  <a href="/user/reports/show_report/<%=record.id%>">
          	  <%= record.username %></a></td>
          	 <td height="30" align="center" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
         	  <a href="/user/reports/show_report/<%=record.id%>">
          	 <%=h truncate(record.testname , :length => 25)%>
          	 </a></td>
             <td height="30" align="center" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
             <%= record.created_at.strftime('%Y年%m月%d日 %H:%M:%S')%></td>
              <td height="30" align="center" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
             <% if record.folder_id %>
                 <%=Folder.find(record.folder_id).name %>
                 <% else%>
                 &nbsp;
             <%end%></td>
             <td height="30" align="center" style="border-bottom:1px solid #dadada; border-right:1px solid #dadada;">
            <% if record.temp_user_name %>
                 <%=record.temp_user_name %>
             <% else%>
                 <%=current_user.username%>
             <%end%>
            </td>
            </tr>       
        <%  end     %>
        <tr><td colspan="7">
        </td></tr>
  <% else %>
  <tr height="120px;"><td colspan="7">
  <div style="margin-left:150px; ">没有符合该条件的报告！
  </td></tr>
  <% end %>
</table><br />
共有：<% if @test_record_num %><%=@test_record_num%><% else %><%=@test_records.size%><% end %>&nbsp;&nbsp;个测试报告 
<div style="margin-left:150px; ">
   <% if @status == nil  %>
     <%= will_paginate(@test_records,:prev_label=>'上一页',:next_label=>'下一页',:separator=>" | ") %>
   <% else %>  
     <% if @test_records.page_count > 1%>
      <div class="pagination">
      <% if params[:page_num].to_i  && params[:page_num].to_i >1%>
      <a href="#" onclick="get_page(<%=params[:page_num].to_i-1%>);"><span>上一页</span></a>|
      <% else %>
      <span>上一页|</span>
      <% end %>
      <% for i in 1..@test_records.page_count%>
      <% if i==params[:page_num].to_i %>
      <span>&nbsp;<%=i%>&nbsp;|</span>
      <% else %>
      <a href="#" onclick="get_page(<%=i%>);"><span>&nbsp;<%=i%>&nbsp;</span></a>|
      <% end %>
      <% end %>
      <% if params[:page_num].to_i >0&& params[:page_num].to_i < @test_records.page_count %>
      <a href="#" onclick="get_page(<%=params[:page_num].to_i+1%>);"><span>下一页</span></a>
      <% else %>
      <span>下一页</span>
      <% end %>
      </div>
      <% end %>

    <% end %>
           
           
</div>
</div>
<script>
function  select_all(o){
  var boxes=document.getElementsByClassName("check_boxes");
       for(i=0; i<boxes.length; i++) {
        boxes[i].checked = o.checked
       }
 }
 function get_page(page){
 var f=document.getElementById("search");
 var page_num=document.getElementById("page_num");
 page_num.value=page;
  ClearCookie("page_num");
  SetCookie("page_num",page);
 sm();
}
</script>
